<?php

include_once 'controller/default.php';
include_once 'model/banner/process.php';
if (isset($_POST)) {
    $banner = new banner();
    if (isset($_POST["accept"])) {
        $insert = $banner->Insert($_POST);
        if ($insert) {
            echo '<script>alert("Thêm Banner thành công.")</script>';
            include 'view/banner/banner_create.php';
        } else {
            echo '<script>alert("Thêm Banner thất bại.")</script>';
            include 'view/banner/banner_create.php';
        }
    } else if (isset($_POST["update"])) {
        $update = $banner->Update($_POST);
        if ($update) {
            echo '<script>alert("Sửa Banner thành công.")</script>';
            include 'view/banner/banner_manager.php';
        } else {
            echo '<script>alert("Sửa Banner thất bại.")</script>';
            include 'view/banner/banner_create.php';
        }
    } if (isset($_POST["updatebanner"])) {
        $update = $banner->UpdateRight($_POST);
        if ($update) {
            echo '<script>alert("Sửa Banner thành công.")</script>';
            include 'view/banner/banner_manager.php';
        } else {
            echo '<script>alert("Sửa Banner thất bại.")</script>';
            include 'view/banner/banner_create.php';
        }
    }
}
?>
